package com.lonely.my.rmi.service.impl;

import com.lonely.my.rmi.UserInterface;
import com.lonely.my.rmi.entity.User;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.List;

/**
 * @date: 2022-03-23 16:52
 * @author: ztkj-hzb
 * @description:
 **/
public class UserInterfaceImpl extends UnicastRemoteObject implements UserInterface {


    /**
     * 注意： 必须手动声明构造方法，且为public的
     *
     * @throws RemoteException
     */
    public UserInterfaceImpl() throws RemoteException {
    }

    /**
     * 获取用户列表
     *
     * @return
     */
    @Override
    public List<User> getUserList() throws RemoteException {
        List<User> users = new ArrayList<>();
        users.add(new User(1, "aa"));
        users.add(new User(2, "bb"));
        return users;
    }
}
